#include <stdio.h>
#define OKBMP        0
#define FILENOTFOUND 1
#define BADFILE      2
#define BADSIZE      3
#define IMAGEOPEND   4
#define NOT256COLORS 5
#define NOIMAGEOPEND 6

#define byte  unsigned char
#define word  unsigned short
#define dword unsigned int

  

typedef struct
{
  dword  bfSize;
  word  bfReserved1;
  word  bfReserved2;
  dword bfoffBits;
  dword biSize;
  dword biWidth;
  dword biHeight;
  word  biPlanes;
  word  biBitCount;
  dword biCompression;
  dword biSizeImage;
  dword biXPelsPerMeter;
  dword biYPelsPerMeter;
  dword biClrUsed;
  dword biClrImportant;
} Entete_BMP;

typedef struct
{
  byte b,g,r,i;
}
Color;

typedef Color Palette[256];

int lx,ly;
Palette VGAPalette;
int openBMP(char *filename,int sizex,int sizey);
byte getpixelBMP(void);
void closeBMP(void);

word  bfType;
Entete_BMP header;

int reopenBMP(void);
void GetHeader(void *p);
void viewerror(int errcode);

extern int  sauve_en_bmp(int,int,int *);
extern int  sauve_en_fich_bmp(char *,int,int,unsigned char *);
extern void initialise_bmp(FILE *, int, int);











